{load header}
<!--/H-->
    <!-- 内容区 -->
    <div id="main-content">
        <div id="top-alert" class="fixed alert alert-error" style="display: none;">
            <button class="close fixed" style="margin-top: 4px;">&times;</button>
            <div class="alert-content">这是内容</div>
        </div>
        <div id="main" class="main">
            
            <!-- nav -->
                        <!-- nav -->
            

            
	<div class="main-title">
        <h2>兑换订单详情</h2>
    </div>
    <div class="cf">
	</div>
	    
    <div class="data-table">
        <div class="data-table table-striped">
            <form action="" method="post" class="form-horizontal">
			<!-----table----->
                        <table class="table table-hover" style="width: 30%;">
				<thead>
				<tr>
					<th width='30%'>选项名称</th>
					<th width='70%'>选项值</th>
				</tr>
				</thead>
				<tbody>
                                        <tr>
                                            <td>申请用户：</td>
                                            
                                                <td>{$item['username']}</td>
					</tr>
                                         <tr>
                                                <td>商品名称：</td>
                                                <td style="font-size:18px;">{$item['title']}</td>
					</tr>
                                        <tr>
                                                <td>商品数量：</td>
                                                <td style="font-size:15px;">{$item['num']}</td>
					</tr>
                                        <tr>
                                                <td>商品类型：</td>
                                                <td style="font-size:16px;">
                                                    {if $item['type'] == 1}
                                                    【实物商品】
                                                    {else}
                                                    【虚拟商品】
                                                    {/if}
                                                </td>
					</tr>
					<tr>
                                            <td>订单编号：</td>
                                            
                                                <td>{$item['order_nid']}</td>
					</tr>
                                        <tr>
                                                <td>兑换消耗金额：</td>
                                                <td style="color: #f39a00;font-size:20px;">{$item['amount']}溜溜币</td>
					</tr>
                                        {if $item['type'] == 1}
                                            <tr>
                                                    <td>姓名（兑换人）：</td>
                                                    <td>{$item['name']}</td>
                                            </tr>
                                            <tr>
                                                    <td>手机（兑换人）：</td>
                                                    <td >{$item['phone']}</td>
                                            </tr>
                                            <tr>
                                                    <td>地址（兑换人）：</td>
                                                    <td >{$item['address']}</td>
                                            </tr>
                                            <tr>
                                                    <td>快递编号：</td>
                                                    <td ><input type="text" id="express_number" class="text input-mid" value="{$item['express_number']}"/>&nbsp;（必填）</td>
                                            </tr>
                                        {else}
                                            <tr>
                                                    <td>充值账号：</td>
                                                    <td style="color: #f39a00;font-size:24px;">{$item['account']}</td>
                                            </tr>
                                        {/if}
                                        <tr>
                                                <td>申请时间：</td>
                                                <td>{$item['create_time']}</td>
					</tr>
                                        <tr>
                                                <td>处理时间：</td>
                                                <td>{$item['update_time']}</td>
					</tr>
                                        <tr>
                                                <td>订单状态：</td>
                                                <td style="color: #f39a00;font-size:24px;">
                                                    {if $item['status'] == 1}
                                                    已兑换
                                                    {elseif $item['status'] == 2}
                                                    处理中
                                                    {else}
                                                    失败
                                                    {/if}
                                                </td>
					</tr>
                                        {if $item['status'] == 2}
                                        <tr>
                                                <td>备注（可选）：
                                                </td>
                                                
                                                <td>
                                                    {if $item['type'] == 1}
                                                    <textarea cols="40" rows="10" id="remark" name="remark" placeholder="格式：快递信息（中通快递：1564561564541564，张三、18357005064、杭州市滨江区南环路源越大厦1506室）"></textarea>
                                                    {else}
                                                    <textarea cols="40" rows="10" id="remark" name="remark" placeholder="格式：充值信息（手机号1564515454充值10元）"></textarea>
                                                    {/if}
                                                </td>
					</tr>
                                        {else}
                                        <tr>
                                                <td>管理员：</td>
                                                <td>{$item['admin_name']}</td>
					</tr>
                                        <tr>
                                                <td>备注：</td>
                                                <td>{$item['remark']}</td>
					</tr>
                                        {/if}
				</tbody>
			</table>
                        <br/>
			<div class="form-item">
                            {if $item['status'] == 2}
                            <input type='hidden' id="order_nid" name="order_nid" value="{$item['order_nid']}"/>
                        <a  href="javascript:void(0);" class="btn submit-btn" id="submit_yes" target-form="form-horizontal">确定兑换</a>
                        <a href="javascript:void(0);" class="btn submit-btn" id="submit_no"  target-form="form-horizontal">拒绝兑换</a>
                        {/if}
			<button class="btn btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
		</div>
            </form>
			<!-----/table----->
			<!-- 分页 -->
		</div>
    </div>
	
	
			</div>
	</div>
<script type="text/javascript">
$(function(){
    $(".submit-btn").click(function(){
        var that = this;
        var _status = $.trim($(this).attr("id"));
        _status = _status == "submit_yes" ? 1 : 0;
        var _nid = $.trim($("#order_nid").val());
        var _number = $.trim($("#express_number").val());
        if(_number == "" || _number == undefined){_number = "";}
        var _remark = $.trim($("#remark").val());
        $.ajax({
            url:"",async: false,dataType:"json",type:"post",data:{status:_status,number:_number,nid:_nid,remark:_remark},
            success:function(data){
                
		if (data.status==1) {
                    if (data.url) {
                        updateAlert(data.info + ' 页面即将自动跳转~','alert-success');
                    }else{
                        updateAlert(data.info ,'alert-success');
                    }
                    setTimeout(function(){
                        if (data.url) {
                            location.href=data.url;
                        }else if( $(that).hasClass('no-refresh')){
                            $('#top-alert').find('button').click();
                            $(that).removeClass('disabled').prop('disabled',false);
                        }else{
                            location.reload();
                        }
                    },1500);
                }else{
                    updateAlert(data.info);
                    setTimeout(function(){
                        if (data.url) {
                            location.href=data.url;
                        }else{
                            $('#top-alert').find('button').click();
                            $(that).removeClass('disabled').prop('disabled',false);
                        }
                    },1500);
                }
            }
        });
    });
});	
</script>
<!--F-->{load footer}